<?php
namespace app\admin\model;
use think\Model;


class Kefu extends model{
	// 后台找全部的公告
	function findall(){
		$result = $this->alias('k')->join('user u','k.user_id=u.id',"left")->field('k.*,u.username uname,u.ipaddrs uip')->order('id desc')->select();
		return $result;
	}
	function findstatus($status){
		$result = $this->alias('k')->where('k.type',$status)->join('user u','k.user_id=u.id',"left")->field('k.*,u.username uname,u.ipaddrs uip')->select();
		return $result;
	}
	function findid($id){
		$result = $this->alias('k')->where('k.id',$id)->join('user u','k.user_id=u.id',"left")->field('k.*,u.username uname,u.ipaddrs uip')->find();
		return $result;
	}
	function findtype($type){
		$result = $this->alias('k')->where('k.type',$type)->join('user u','k.user_id=u.id',"left")->field('k.*,u.username uname,u.ipaddrs uip')->find();
		return $result;
	}
}